<template>
	<div class="main">
		<navTop></navTop>
		<div class="breadBox">
			<el-breadcrumb separator="/">
			  <el-breadcrumb-item :to="{ path: '/examindex' }">考试管理</el-breadcrumb-item>
			  <el-breadcrumb-item>评阅教师管理</el-breadcrumb-item>
			</el-breadcrumb>
		</div>
		<div class="contentMain">
			<div class="searchlist">
				<router-link to="/examoverview" active-class="hover">考试概览</router-link>
				<router-link to="/studentmanage" active-class="hover">考生管理</router-link>
				<router-link to="/teachermanage" active-class="hover">评阅教师管理</router-link>
				<router-link to="/scorerelease" active-class="hover">成绩管理</router-link>
			</div>
			<div class="overviewcontent">
				<div class="overvcontentTop">
					<div>
						<h3 style="font-weight: bold;">{{examlist.name}}</h3>
						<div class="examInfo">
							<b><i>时间：</i>{{examlist.startTime | formatDate}}</b>
							<b>
								<i>年级：</i>
								<em v-if=" examlist.studentRange.length===0">--</em>
								<em v-for="item in examlist.studentRange" v-else>{{item.gradeName?item.gradeName:'--'}}</em>
							</b>
							<b><i>考试模式：</i>{{examlist.optionalName}}</b>
							<b><i>上传方式：</i>本地识别后上传</b>
							<b><i>评阅方式：</i>{{examlist.markHubType==1?'全校阅卷':examlist.markHubType==2?'分班阅卷':examlist.markHubType==3?'导入成绩':examlist.markHubType==4?'先批后扫':'线上考试'}}</b>
						</div>
					</div>
					<span @click="addExam(examlist)">编辑考试</span>
				</div>
				<div class="studentSearch">
					<el-select v-model="njgradeId" placeholder="学部/年级" clearable @change="njgradechange">
					    <el-option
					      v-for="item in gradelist"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id">
					    </el-option>
					</el-select>
					<el-select v-model="questionarray" placeholder="评阅题组" clearable>
					    <el-option
					      v-for="item in gradelist"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id">
					    </el-option>
					</el-select>
					<el-select v-model="subjectcourseId" placeholder="管理科目" clearable @change="managesubjectchange" @clear="clearboxset">
					    <el-option
					      v-for="item in subjectlist"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id">
					    </el-option>
					</el-select>
					<el-select v-model="roleteachedid" placeholder="角色" clearable @change="rolechange">
					    <el-option
					      v-for="item in rolelist"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id">
					    </el-option>
					</el-select>
					<el-input placeholder="手机号" v-model="teacherobj.query.phoneNumber" clearable  @change="managename"></el-input>
					<el-input placeholder="教师姓名" v-model="teacherobj.query.teacherName" clearable @change="managename"></el-input>
				</div>
				<div class="tableContent">
					<el-table
						class="custom-table"
					    ref="multipleSelection"
					    :data="teacherlist"
					    tooltip-effect="dark"
					    style="width: 100%"
					    @selection-change="handleSelectionChange"
						stripe
						:header-cell-style="{ background: '#D8E4F0', color: '#2A303B',fontWeight:'500' }">
					    <el-table-column
					      type="selection"
					      width="55">
					    </el-table-column>
					    <el-table-column
					      label="ID"
						    width="150">
					      <template slot-scope="scope">{{ scope.row.id }}</template>
					    </el-table-column>
					    <el-table-column
					      prop="name"
					      label="姓名">
					    </el-table-column>
						<el-table-column
						  label="角色"
						  width="180">
						  <template slot-scope="scope">
							   <ul class="answerlist">
								   <li style="width:auto;padding:0 5px;" v-for="item in scope.row.teacherRoles">{{item.roleName}}</li>
								</ul>
						  </template>
						</el-table-column>
					    <el-table-column
					      prop="phoneNumber"
					      label="手机号&账号"
						  width="120">
					    </el-table-column>
						<el-table-column
						  label="管理科目"
						  width="170">
						  <template slot-scope="scope">
							  <ul class="answerlist">
							  		<li v-for="item in scope.row.courses">{{item.coursesName}}</li>
							  </ul>
						  </template>
						</el-table-column>
						<el-table-column
						  label="评阅范围">
						  <template slot-scope="scope">
							  <span v-for="item in scope.row.grade">{{item.name}}</span>
						  </template>
						</el-table-column>
						<el-table-column
						  label="所阅题组">
						  <template slot-scope="scope">
							  <ul class="answerlist">
								  <li v-for="item in scope.row.topicGroup">{{item.name}}</li>
							  </ul>
						  </template>
						</el-table-column>
						<el-table-column
						  label="临时教师">
						  <template slot-scope="scope">
							  <span :class="scope.row.isTemporaryAccount==true?'smallsubject':'smallsubject1'">{{ scope.row.isTemporaryAccount==true?'是':'否' }}</span>
						  </template>
						</el-table-column>
						<el-table-column
							fixed="right"
							label="操作"
							align="center"
							width="150">
							<template slot-scope="scope">
								<div style="display: flex;">
									<el-button @click="handleClick(scope.row)" type="text" size="small" style="display: flex;align-items: center;"><img src="../../assets/image/school/edit.png" style="width:12px;margin-right:5px;" />编辑</el-button>
									<el-button type="text" @click="deleteteacher(scope.row.id)" size="small" style="display: flex;align-items: center;color:#EC555A"><img src="../../assets/image/school/del.png" style="width:12px;margin-right:5px;" />删除</el-button>
								</div>
							</template>
						</el-table-column>
					  </el-table>
				</div>
			</div>
		</div>
		<div class="examfooter">
			<div class="examFootercontent">
				<div class="totaldata">
					<span>已选<i>{{multipleSelection.length}}</i>项 / 共{{total}}项</span>
					<em @click="choosestudent">选择教师</em>
					<em @click="addExamcopy">名单复用</em>
					<!-- <em @click="addteacher">新建教师</em>
					<em @click="pldrimport">批量导入</em>
					<em @click="roleTab">权限管理</em>
					<em @click="passwordcl">密码策略</em> -->
					<em @click="batchTeacher">批量删除</em>
				</div>
				<div>
					<el-pagination
						background
					      @current-change="handleCurrentChange"
					      layout="prev, pager, next, jumper"
						  :page-size="teacherobj.pageSize"
					      :total="total">
					 </el-pagination>
				</div>
			</div>
		</div>
		<examEdite v-if="addExamIshow" @addexamclick="addexamclick" :examobj="examobj" :addexamtype="addexamtype"></examEdite>
		<!-- 选择教师 -->
		<div class="addExamMain" v-if="choosetteacherishow">
			<div class="addExamContent">
				<h3>选择评阅教师范围</h3>
				<div class="choosestudent">
					<span style="width:71px;">选择年级：</span>
					<div class="inputBox">
						<el-select v-model="selectchooselist.gradeIds" multiple placeholder="请选择年级">
						 <el-option
						   v-for="item in gradelist"
						   :key="item.id"
						   :label="item.name"
						   :value="item.id"
						   @click.native="choosegradechange">
						 </el-option>
						</el-select>
					</div>
					<span style="width:71px;margin-left:20px;">选择学科：</span>
					<div class="inputBox">
						<el-select v-model="selectchooselist.subjectIds" multiple placeholder="请选择学科">
						  <el-option
							v-for="item in subjectlist"
							:key="item.id"
							:label="item.name"
							:value="item.id"
							@click.native="choosesubjectchange">
						  </el-option>
						</el-select>
					</div>
				</div>
				<div>
					<el-checkbox  :checked="allChecked" :indeterminate="isIndeterminateAll"  @change="handleCheckAllChangeAll($event)">全选</el-checkbox>
				    <div v-for="(month, index) in teacherselectlist" :key="index" class="checkbox-group">
				      <el-checkbox :checked="month.newCheckall":indeterminate="isIndeterminate(month)"  @change="handleCheckAllChange(month, $event)">{{month.gradeName}}</el-checkbox>
				      <el-checkbox-group v-model="month.newSelectall" class="horizontal-checkbox-group">
				        <el-checkbox
				          v-for="option in month.teachers"
						  :key="option.id"
				          :label="option.id">
				          {{ option.name }}
				        </el-checkbox>
				      </el-checkbox-group>
				    </div>
				  </div>
				  <p class="xzpjya">已选择评阅教师：<i>{{getSelectedTeachersCount}}</i></p>
				  <div class="groupbutton">
				  	<el-button type="primary" @click="teachersure">确定</el-button>
				  	<el-button type="primary" @click="teachergoback">返回</el-button>
				  </div>
			</div>
		</div>
		<!-- 批量导入 -->
		<div class="addExamMain" v-if="batcImportteacherIshow">
			<div class="addExamContent">
				<h3>批量上传临时学生</h3>
				<div class="uploadbox">
					<el-upload
					  class="upload-demo"
					  drag
					  action="https://jsonplaceholder.typicode.com/posts/">
					  <i class="el-icon-upload"></i>
					  <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
					  <div class="el-upload__tip" slot="tip">每次导入仅能上传一个文件</div>
					</el-upload>
					<a href="#" class="downmoban">下载模板</a>
				</div>
				<div class="groupbutton">
					<el-button type="primary" @click="batcImportteachertsure">确认</el-button>
					<el-button type="primary" @click="batcImportteachergoback">取消</el-button>
				</div>
			</div>
		</div>
		<!-- 密码策略 -->
		<div class="addExamMain" v-if="PasswordPolicyIshow">
			<div class="addExamContent">
				<h3>密码策略</h3>
				<div class="attentionPassword">
					<p>请选择密码设置规则(仅对评阅教师生效)</p>
					<el-checkbox>重置为手机号后六位</el-checkbox>
					<el-checkbox>重置为手机号后六位</el-checkbox>
					<el-checkbox>重置为统一密码</el-checkbox>
					<el-input clear></el-input>
					<el-checkbox>重置为前缀加手机号后六位</el-checkbox>
					<el-input clear></el-input>
					<el-checkbox>重置为前缀加手机号后六位</el-checkbox>
					<el-input clear></el-input>
				</div>
				
				<div class="groupbutton">
					<el-button type="primary" @click="PasswordPolicysure">确认</el-button>
					<el-button type="primary" @click="PasswordPolicygoback">取消</el-button>
				</div>
			</div>
		</div>
		<!-- 权限管理 -->
		<div class="addExamMain" v-if="roleishow">
			<div class="addExamContent" style="width:1060px;">
				<h3>权限管理</h3>
				<p style="padding:0px 0 15px;color:#B3B8C2;">维护当前项目内各角色的权限，修改完成后仅对当前考试生效。</p>
				<div class="tablestyle">
					<table cellspacing="0" cellpadding="0" style="width:100%">
						<tr>
							<th>角色</th>
							<th>信息设置与状态变更</th>
							<th>扫描答题卡</th>
							<th>评阅管理与监控</th>
							<th>发布成绩与分析</th>
						</tr>
						<tr v-for="item in teacherlinstrole">
							<td width="100" align="center" style="text-align: center;">{{item.role}}</td>
							<td width="200">
							 <el-checkbox-group v-model="item.teacherCheckboxInfo" @change="handleCheckedCitiesChange">
								<el-checkbox v-for="checkitem in item.teacherCheckboxInfolist" :label="checkitem" :key="checkitem">{{checkitem}}</el-checkbox>
							  </el-checkbox-group>
							</td>
							<td width="200">
								<el-checkbox-group v-model="item.teacherCheckboxCard" @change="handleCheckedCitiesChange">
									<el-checkbox  v-for="checkitem in item.teacherCheckboxCardlist" :label="checkitem" :key="checkitem">{{checkitem}}</el-checkbox>
								 </el-checkbox-group>
							</td>
							<td width="300">
								<el-checkbox-group v-model="item.teacherCheckboxYjjk" @change="handleCheckedCitiesChange">
									<el-checkbox  v-for="checkitem in item.teacherCheckboxYjjklist" :label="checkitem" :key="checkitem">{{checkitem}}</el-checkbox>
								 </el-checkbox-group>
							</td>
							<td width="200">
								<el-checkbox-group v-model="item.teacherCheckboxscorefb" @change="handleCheckedCitiesChange">
									<el-checkbox  v-for="checkitem in item.teacherCheckboxscorefblist" :label="checkitem" :key="checkitem">{{checkitem}}</el-checkbox>
								 </el-checkbox-group>
							</td>
						</tr>
					</table>
					<div class="groupbutton">
						<el-button type="primary" @click="rolesure">确认</el-button>
						<el-button type="primary" @click="rolegoback">取消</el-button>
					</div>
				</div>
			</div>
		</div>
		<!-- 创建编辑教师 -->
		<div class="addExamMain" v-if="exditteacherIshow">
			<div class="addExamContent">
				<h3>创建/编辑教师</h3>
				<ul>
					<li>
						<span style="width:110px;">ID：</span>
						<div class="inputBox">
							<el-input v-model="exitStudent.id" placeholder="请输入内容" @input="handleInput"></el-input>
						</div>
					</li>
					<li>
						<span style="width:110px;">教师姓名：</span>
						<div class="inputBox">
							<el-input v-model="exitStudent.name" placeholder="请输入内容" @input="handleInput"></el-input>
						</div>
					</li>
					<li>
						<span style="width:110px;">手机号&账号：</span>
						<div class="inputBox">
							<el-input v-model="exitStudent.xh" placeholder="请输入内容" @input="handleInput"></el-input>
						</div>
					</li>
					<li>
						<span style="width:110px;">密码：</span>
						<div class="inputBox">
							<el-input v-model="exitStudent.examnumber" placeholder="请输入内容" @input="handleInput"></el-input>
						</div>
					</li>
					<li>
						<span style="width:110px;">角色：</span>
						<div class="inputBox">
							<el-select v-model="exitStudent.xb" multiple placeholder="请选择">
							  <el-option
								v-for="item in gradelist"
								:key="item.id"
								:label="item.name"
								:value="item.id">
							  </el-option>
							</el-select>
						</div>
					</li>
					<li>
						<span style="width:110px;">评阅&管理科目：</span>
						<div class="inputBox">
							<el-select v-model="exitStudent.xb" multiple placeholder="请选择">
							  <el-option
								v-for="item in gradelist"
								:key="item.id"
								:label="item.name"
								:value="item.id">
							  </el-option>
							</el-select>
						</div>
					</li>
					<li>
						<span style="width:110px;">评阅范围：</span>
						<div class="inputBox">
							<el-select v-model="exitStudent.xb" multiple placeholder="请选择">
							  <el-option
								v-for="item in gradelist"
								:key="item.id"
								:label="item.name"
								:value="item.id">
							  </el-option>
							</el-select>
						</div>
					</li>
					<li>
						<span style="width:110px;">评阅题组：</span>
						<div class="inputBox">
							<el-select v-model="exitStudent.xb" multiple placeholder="请选择" disabled>
							  <el-option
								v-for="item in gradelist"
								:key="item.id"
								:label="item.name"
								:value="item.id">
							  </el-option>
							</el-select>
						</div>
					</li>
					<li>
						<span style="width:110px;">临时教师：</span>
						<div class="inputBox">
							<el-select v-model="exitStudent.smallyz" placeholder="请选择">
							  <el-option
								v-for="item in gradelist"
								:key="item.id"
								:label="item.name"
								:value="item.id">
							  </el-option>
							</el-select>
						</div>
					</li>
					<li style="color:red;" v-if="attentionIshow">
						<span></span>
						<i class="el-icon-warning-outline" style="margin-right:5px;"></i>{{attention}}
					</li>
				</ul>
				<div class="groupbutton">
					<el-button type="primary" @click="exditteachersure">保存</el-button>
					<el-button type="primary" @click="exditteachergoback">返回</el-button>
				</div>
			</div>
		</div>
		<!-- 创建复用考试 -->
		<examCopy v-if="examCopyIshow" @copyexamclick="copyexamclick" :type="2"></examCopy>
	</div>
</template>

<script>
	import navTop from "../../components/school/head.vue"
	import examEdite from '../../components/school/exditexam.vue'
	import examCopy from '../../components/school/copyexam.vue'
	import { get, post, del, put } from '../../request/api.js'
	export default{
		data(){
			return{
				addExamIshow:false,	
				teacherlist:[],
				teacherselectlist:[],
				months: [
				        {
				          name: '高三',
				          options: [
							  { value: '1班', label: '1班' },],
				          selected: [],
				          checkedAll: false
				        },
						{
						  name: '高三',
						  options: [{ value: '1班', label: '1班' }, { value: '1班', label: '1班' },{ value: '1班', label: '1班' }, { value: '1班', label: '1班' },],
						  selected: [],
						  checkedAll: false
						},
				        // 其他月份数据...
				      ],
					  choosestudentIshow:false,
					  allChecked: false, // 全局全选状态
					  choosetteacherishow:false,
					  batcImportteacherIshow:false,
					  PasswordPolicyIshow:false,
					  teacherlinstrole:[
						  {
							  id:1,
							  role:'教师',
							  teacherCheckboxInfo:[],
							  teacherCheckboxInfolist:['信息设置','试题管理','模版管理'],
							  teacherCheckboxCard:[],
							  teacherCheckboxCardlist:['扫描进度','扫描异常','客观题异常'],
							  teacherCheckboxYjjk:[],
							  teacherCheckboxYjjklist:['试题评阅','任务分配','评阅进度','评卷设置','异常处理','仲裁监控'],
							  teacherCheckboxscorefb:[],
							  teacherCheckboxscorefblist:['发布设置','分析查询','成绩补录','批量修改']
						  },
						  {
							  id:2,
							  role:'学科组长',
							  teacherCheckboxInfo:[],
							  teacherCheckboxInfolist:['信息设置','试题管理','模版管理'],
							  teacherCheckboxCard:[],
							  teacherCheckboxCardlist:['扫描进度','扫描异常','客观题异常'],
							  teacherCheckboxYjjk:[],
							  teacherCheckboxYjjklist:['试题评阅','任务分配','评阅进度','评卷设置','异常处理','仲裁监控'],
							  teacherCheckboxscorefb:[],
							  teacherCheckboxscorefblist:['发布设置','分析查询','成绩补录','批量修改']
						  },
						  {
							  id:3,
							  role:'考试管理员',
							  teacherCheckboxInfo:[],
							  teacherCheckboxInfolist:['信息设置','试题管理','模版管理'],
							  teacherCheckboxCard:[],
							  teacherCheckboxCardlist:['扫描进度','扫描异常','客观题异常'],
							  teacherCheckboxYjjk:[],
							  teacherCheckboxYjjklist:['试题评阅','任务分配','评阅进度','评卷设置','异常处理','仲裁监控'],
							  teacherCheckboxscorefb:[],
							  teacherCheckboxscorefblist:['发布设置','分析查询','成绩补录','批量修改']
						  },
						  {
							  id:4,
							  role:'学校管理',
							  teacherCheckboxInfo:[],
							  teacherCheckboxInfolist:['信息设置','试题管理','模版管理'],
							  teacherCheckboxCard:[],
							  teacherCheckboxCardlist:['扫描进度','扫描异常','客观题异常'],
							  teacherCheckboxYjjk:[],
							  teacherCheckboxYjjklist:['试题评阅','任务分配','评阅进度','评卷设置','异常处理','仲裁监控'],
							  teacherCheckboxscorefb:[],
							  teacherCheckboxscorefblist:['发布设置','分析查询','成绩补录','批量修改']
						  }
					  ],
					  roleishow:false,
					  exditteacherIshow:false,
					  exitStudent:{
						  id:'',
						  name:'',
						  xh:'',
						  examnumber:'',
						  xb:'',
						  grade:'',
						  class:'',
						  xk:'',
						  smallyz:''
					  },
					  examlist:{},
					  examobj:{},
					  examobjcontent:{},
					  teacherobj:{
						page: 1,
						pageSize:10,
						query: {
							examId: 0,
							gradeId: 0,
							topicGroupId: 0,
							courseId: 0,
							roreId: 0,
							phoneNumber: "",
							teacherName: "" 
					    }
					},
					total:null,
					multipleSelection: [],
					subjectlist:[],
					subjectcourseId:null,
					examCopyIshow:false,
					njgradeId:null,
					questionarray:null,
					roleteachedid:null,
					rolelist:[],
					selectchooselist:{
						gradeIds:[],
						subjectIds:[]
					},
					teacherselectobj:{
						examId:0,
						teacherIds:[]
					}
			}
		},
		mounted() {
			this.examobjcontent = JSON.parse(sessionStorage.getItem('examContent'))
			this.examoverive(this.examobjcontent.id)
			this.teacherlisttab(this.examobjcontent.id)
			this.managesubjecttab()
			this.gradelisttab()
			this.roletablist()
		},
		methods:{
			//删除学生
			deleteteacher(id){
				let obj={
					id:this.examobjcontent.id,
					ids:[id]
				}
				 this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
				          confirmButtonText: '确定',
				          cancelButtonText: '取消',
				          type: 'warning'
				        }).then(() => {
							post('/examteacher/batchdelte',obj)
							.then(res=>{
								if(res.code==200){
									this.$message({
									  type: 'success',
									  message: '删除成功!'
									});
									this.teacherlisttab(this.examobjcontent.id)
								}else{
									this.$message({
									  type: 'error',
									  message: res.message
									});
								}
							})
							.catch(error=>{
								this.$message({
								  type: 'error',
								  message: error.message
								});
							})
				        }).catch(() => {
				          this.$message({
				            type: 'info',
				            message: '已取消删除'
				        });          
				})
			},
			// 批量删除学生
			batchTeacher(){
				if(this.multipleSelection.length>0){
					let obj={
						id:this.examobjcontent.id,
						ids:this.multipleSelection.map(item=>item.id)
					}
					 this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					          confirmButtonText: '确定',
					          cancelButtonText: '取消',
					          type: 'warning'
					        }).then(() => {
								post('/examteacher/batchdelte',obj)
								.then(res=>{
									if(res.code==200){
										this.$message({
										  type: 'success',
										  message: '删除成功!'
										});
										this.teacherlisttab(this.examobjcontent.id)
									}else{
										this.$message({
										  type: 'error',
										  message: res.message
										});
									}
								})
								.catch(error=>{
									this.$message({
									  type: 'error',
									  message: error.message
									});
								})
					        }).catch(() => {
					          this.$message({
					            type: 'info',
					            message: '已取消删除'
					        });          
					})
				}else{
					this.$message({
					  type: 'warning',
					  message:'请先选择要删除的内容'
					});
				}
			},
			copyexamclick(data){
				this.examCopyIshow = data
				this.teacherlisttab(this.examobjcontent.id)
			},
			handleCurrentChange(val){
				this.teacherobj.page = val
				this.teacherlisttab(this.examobjcontent.id)
			},
			addExamcopy(){
				this.examCopyIshow = true
			},
			examoverive(id){
				get('/exam/details', { examId: id })
				.then(res => {
					//console.info(res)
					if(res.code==200){
						this.examlist = res.data
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error => {
					  // 处理错误
					  this.$message.error(error.message);
				});
			},
			// 获取教师列表
			teacherlisttab(id){
				this.teacherobj.query.examId = id
				post('/examteacher/list',this.teacherobj)
				.then(res=>{
					if(res.code==200){
						this.teacherlist = res.data.items
						this.total = res.data.total
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error=>{
					this.$message.error(error.message);
				})
			},
			// 新建考试
			addExam(obj){
				this.examobj=obj
				this.addExamIshow = true
			},
			addexamclick(data){
				if(data=='返回'){
					this.addExamIshow=false
				}else{
					this.examoverive(this.examobjcontent.id)
					this.addExamIshow=data
				}
			},
			// 跳转不同页面
			routerlink(link){
				this.$router.push(link)
			},
			// 管理科目
			managesubjecttab(){
				get('/course/alllist')
				.then(res=>{
					if(res.code==200){
						this.subjectlist = res.data
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error=>{
					this.$message.error(error.message);
				})
			},
			//获取年纪列表
			gradelisttab(){
				get('/grade/list')
				.then(res=>{
					if(res.code==200){
						this.gradelist = res.data
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error=>{
					this.$message.error(error.message);
				})
			},
			// 选择教师
			chooserteachertab(){
				post('/teacher/listbycourse',this.selectchooselist)
				.then(res=>{
					if(res.code==200){
						// const responseData = res.data;
						// const filteredData = res.data.filter(item => item); // 过滤掉空数据
						this.teacherselectlist = res.data.map(item => ({
							...item,
							newCheckall:false,
							newSelectall:[],
						}));
						//console.info(this.teacherselectlist)
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error=>{
					this.$message.error(error.message);
				})
			},
			// 选择年纪
			choosegradechange(val){
				this.chooserteachertab()
			},
			// 选择学科
			choosesubjectchange(val){
				this.chooserteachertab()
			},
			handleCheckAllChange(month, checked) {
			  if (checked) {
				month.newSelectall = month.teachers.map(option => option.id);
			  } else {
				month.newSelectall = [];
			  }
			  this.isIndeterminate(month);
			},
			isIndeterminate(month) {
			  return month.newSelectall.some(value => month.teachers.map(option => option.id).includes(value)) && month.newSelectall.length !== month.teachers.length;
			},
			handleCheckAllChangeAll(checked) {
			  this.teacherselectlist.forEach(month => {
				month.newCheckall = checked;
				month.newSelectall = checked ? month.teachers.map(option => option.id) : [];
			  });
			},
			
			//获取角色列表
			roletablist(){
				get('/system/role')
				.then(res=>{
					if(res.code==200){
						this.rolelist = res.data
					}else{
						this.$message.error(res.message);
					}
				})
				.catch(error=>{
					this.$message.error(error.message);
				})
			},
			clearboxset(){
				this.teacherlisttab(this.examobjcontent.id)
			},
			managesubjectchange(val){
				if(val==''){
					this.teacherobj.query.courseId = 0
				}else{
					this.teacherobj.query.courseId = val
				}
				this.teacherlisttab(this.examobjcontent.id)
			},
			njgradechange(val){
				if(val==''){
					this.teacherobj.query.gradeId = 0
				}else{
					this.teacherobj.query.gradeId = val
				}
				this.teacherlisttab(this.examobjcontent.id)
			},
			rolechange(val){
				if(val==''){
					this.teacherobj.query.roreId = 0
				}else{
					this.teacherobj.query.roreId = val
				}
				this.teacherlisttab(this.examobjcontent.id)
			},
			managename(){
				this.teacherlisttab(this.examobjcontent.id)
			},
			choosestudent(){
				this.choosetteacherishow = true
			},
			teachersure(){
				this.teacherselectobj.teacherIds = this.teacherselectlist.reduce((acc, item) => { return acc.concat(item.newSelectall);}, []);
				this.teacherselectobj.examId = this.examobjcontent.id
				post('/exam/selectteacher',this.teacherselectobj)
				.then(res=>{
					if(res.code==200){
						this.choosetteacherishow = false
						this.teacherlisttab(this.examobjcontent.id)
					}else{
						this.$message({
							type: 'error',
							message: res.message
						});
					}
				})
				// .catch(error=>{
					
				// })
			},
			teachergoback(){
				this.choosetteacherishow = false
			},
			pldrimport(){
				this.batcImportteacherIshow = true
			},
			batcImportteachertsure(){
				this.batcImportteacherIshow = false
			},
			batcImportteachergoback(){
				this.batcImportteacherIshow = false
			},
			roleTab(){
				this.roleishow = true
			},
			rolesure(){
				this.roleishow = false
			},
			rolegoback(){
				this.roleishow = false
			},
			passwordcl(){
				this.PasswordPolicyIshow = true
			},
			PasswordPolicysure(){
				this.PasswordPolicyIshow = false
			},
			PasswordPolicygoback(){
				this.PasswordPolicyIshow = false
			},
			addteacher(){
				this.exditteacherIshow = true
			},
			exditteachersure(){
				this.exditteacherIshow = false
			},
			exditteachergoback(){
				this.exditteacherIshow = false
			},
			handleSelectionChange(val){
				 this.multipleSelection = val;
			}
		},
		computed: {
		    isIndeterminateAll() {
		      return this.teacherselectlist.some(month => month.newSelectall.length > 0) && !this.teacherselectlist.every(month => month.newSelectall.length === month.teachers.length);
		    },
			getSelectedTeachersCount() {
			  return this.teacherselectlist.reduce((acc, item) => {
				// 确保 newSelectall 是数组
				const selectCount = Array.isArray(item.newSelectall) ? item.newSelectall.length : 0;
				return acc + selectCount;
			  }, 0); // 初始值设为 0
			}
		  },
		components:{navTop,examEdite,examCopy}
	}
</script>

<style scoped>
	.main{
		width:100vw;
		height:100vh;
		background: #F4F7FD;;
		overflow-x:hidden;
		overflow-y: auto;
	}
	/* .main::-webkit-scrollbar {
		 height:8px;
		background-color: #eee;
		border-radius:10px;
	}
	.main::-webkit-scrollbar-track {
		background-color: #eee;
		border-radius:10px;
	}
	.main::-webkit-scrollbar-thumb {
		background: #619CF5;
		border-radius: 10px;
	} */
	.contentMain{
		width:auto;padding:0 40px;
		margin:0 auto;
		padding-bottom:30px;
	}
	.breadBox{
		height:32px;
		background: #fff;
		line-height: 32px;
		margin-top:2px
	}
	.el-breadcrumb{
		width:auto;padding:0 40px;
		margin:0 auto;
		line-height:30px;
		font-size:14px;
	}
	.el-breadcrumb__inner a, .el-breadcrumb__inner.is-link{
		color:#B3B8C2
	}
	.searchlist{
		box-sizing: border-box;
		width:auto;padding:0 40px;
		display: flex;
		justify-content: space-between;
		height: 54px;
		background: #FFFFFF;
		border-radius: 10px;
		padding:0 24px;
		align-items: center;
		margin-top:14px;
	}
	.searchlist{
		padding-left:20px;
		display: flex;
		align-items: center;
		justify-content: left;
	}
	.searchlist a{
		display: block;
		color:#557292;
		font-size:14px;
		width:100px;
		text-align: center;
		position: relative;
		line-height:52px;
	}
	.searchlist a:hover,.searchlist a.hover{
		color:#295CFF;
	}
	.searchlist a:hover::after,.searchlist a.hover::after{
		content:'';
		width: 24px;
		height: 4px;
		background: #295CFF;
		border-radius: 2px;
		position: absolute;
		left:50%;
		transform: translateX(-50%);
		bottom:0;
	}
	.overviewcontent{
		background: #FFFFFF;
		box-shadow: 0px 4px 16px 0px rgba(85,114,146,0.1);
		border-radius: 10px;
		width:auto;padding:0 40px;
		margin:20px auto;
	}
	.examInfo{
		display: flex;
		align-items: center;
	}
	.examInfo b{
		font-weight: normal;
		font-size:14px;
		color:#333;
		position: relative;
		padding-right:14px;
		margin-right:14px;
	}
	.examInfo b i{
		font-style:normal;
		color:#8E96A4
	}
	.examInfo b::after{
		content:'';
		width: 1px;
		height: 8px;
		background:#DEE1E7;
		position:absolute;
		right:0;
		top:50%;
		transform: translateY(-50%);
	}
	.examInfo b:last-child::after{
		content:'';
		width: 1px;
		height: 8px;
		background:#fff;
		position:absolute;
		right:0;
		top:50%;
		transform: translateY(-50%);
	}
	.overvcontentTop{
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding:24px;
	}
	.overvcontentTop h3{
		font-size:18px;
		font-weight:500;
		padding-bottom:15px;
	}
	.overvcontentTop span{
		width: 124px;
		height: 34px;
		background: #295CFF;
		border-radius: 10px;
		font-size: 14px;
		color: #FFFFFF;
		text-align: center;
		line-height:34px;
		cursor: pointer;
	}
	.tableContent{
		padding:0 24px 30px;
		border-radius: 10px;
	}
	.tableContent table{
		border-radius: 10px;
		border: 1px solid rgba(216,228,240,0.5);
	}
	.tableContent table tr th{
		font-size:14px;
		font-weight:normal;
		background:#E8F0FA;
		height:42px;
	}
	.tableContent table tr th:first-child{
		border-radius: 8px 0 0 0;
	}
	.tableContent table tr th:last-child{
		border-radius: 0 8px 0 0;
	}
	.tableContent table tr td{
		height:42px;
		text-align: center;
		font-size:14px;
		border-right:solid 1px rgba(216,228,240,0.34);
	}
	.tableContent table tr td:last-child{
		border-right:none;
	}
	.tableContent table tr td i{
		display: block;
		font-style: normal;
		font-size:12px;
		color:#999
	}
	.tableContent table tr td em{
		display: block;
	}
	.tableContent table tr td span{
		position:relative;
		display: inline-block;
		cursor: pointer;
	}
	.tableContent table tr td span em{
		font-size:12px;
		font-style:normal;
	}
	.tableContent table tr td span::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#000;
	}
	.tableContent table tr td span.green{
		color:#288F41
	}
	.tableContent table tr td span.green::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#288F41;
	}
	.tableContent table tr td span.blue{
		color:#295CFF
	}
	.tableContent table tr td span.blue::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#295CFF;
	}
	.tableContent table tr td span.red{
		color:#EC555A
	}
	.tableContent table tr td span.red::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#EC555A;
	}
	.tableContent table tr td span.gray{
		color:#D8E4F0
	}
	.tableContent table tr td span.gray::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#D8E4F0;
	}
	.tableContent table tr:nth-child(3n){
		background:#FAFAFB
	}
	.studentSearch{
		display: flex;
		padding:0 24px 24px;
		justify-content: left;
	}
	.studentSearch .el-select{
		width:124px;
		margin-right:24px;
	}
	.studentSearch >>> .el-input__inner{
		width: 124px;
		border-radius: 10px;
		height:35px;
		font-size:14px;
	}
	.studentSearch >>> .el-input__icon{
		line-height:35px;
	}
	.el-input{
		width:auto;
		margin-right:24px;
	}
	.studentSearch b{
		width: 124px;
		height: 34px;
		background: #295CFF;
		border-radius: 10px;
		font-size: 14px;
		color: #FFFFFF;
		text-align: center;
		line-height:34px;
		cursor: pointer;
	}
	.examfooter{
		width:100%;
		height:54px;
		background: rgba(255,255,255,0.6);
		box-shadow: 0px 4px 16px 0px rgba(85,114,146,0.1);
		position:fixed;
		left:0;
		bottom:0;
		z-index:100
	}
	.examFootercontent{
		width:auto;padding:0 40px;
		margin:0 auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.examFootercontent .totaldata{
		font-size:14px;
		color:#557292;
		display: flex;
		justify-content: left;
		align-items: center;
	}
	.examFootercontent .totaldata i{
		display: inline-block;
		color:#295CFF;
		font-style: normal;
		line-height:54px;
		padding:0 3px;
	}
	.examFootercontent .totaldata em{
		font-style:normal;
		width: 89px;
		height: 34px;
		border-radius: 10px;
		line-height:34px;
		background: #295CFF;
		text-align: center;
		color:#fff;
		margin-left:7px;
		cursor: pointer;
	}
	.examFootercontent .totaldata em:last-child{
		background:#EC555A;
	}
	.examFootercontent .totaldata >>> .el-pager li.active{
		background-color:#295CFF
	}
	.scorered{
		font-size:14px;
		color:#EC555A;
		padding:24px 0;
	}
	.custom-table {
	  width: 100%;
	  border: 1px solid rgba(216,228,240,0.34);
	  border-radius:10px;
	  border-right: none;
	  border-bottom:none;
	}
	
	/* 自定义表格内部元素的样式 */
	.custom-table >>> .el-table__header-wrapper th {
	  background-color: #E8F0FA;
	  height:42px;
	  padding:0;
	  text-align: center;
	  font-weight:normal
	}
	.custom-table >>> .el-table__row td {
	  height:42px;
	  padding:0;
	  text-align: center;
	  border-bottom:none;
	  border-right:solid 1px rgba(216,228,240,0.34);
	  font-size:14px;
	}
	.el-table .warning-row {
	    background: #ffffff;
	 }
	.el-table .success-row {
	    background: #D8E4F0;
	}
	.examFootercontent >>> .el-pagination__jump{
		margin-left:5px;
	}
	.examFootercontent >>> .el-pager{
		margin-top:2px;
	}
	.examFootercontent >>> .el-pager li{
		margin:0 3px;
		min-width:25px;
		height: 25px;
		line-height: 25px
	}
	.examFootercontent >>> .el-pagination button{
		height:25px;
		line-height:25px;
		margin-top:2px;
	}
	.answerlist{
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
	}
	.smallsubject{
		width: 48px;
		height: 22px;
		font-size:14px;
		text-align: center;
		line-height:22px;
		border-radius: 6px;
		margin:0 5px;
		background: rgba(41,92,255,0.06);
		border-radius: 6px;
		border: 1px solid rgba(41,92,255,0.5);
		color:rgba(41,92,255,1);
	}
	.smallsubject1{
		width: 48px;
		height: 22px;
		font-size:14px;
		text-align: center;
		line-height:22px;
		margin:0 5px;
		background: rgba(236,85,90,0.06);
		border-radius: 6px;
		border: 1px solid rgba(236,85,90,0.5);
		color: rgba(236,85,90,1);
	}
	.answerlist li{
		width: 48px;
		height: 22px;
		font-size:14px;
		text-align: center;
		line-height:22px;
		border-radius: 6px;
		margin:2px 5px;
		border: 1px solid rgba(41,92,255,0.5);
		color:rgba(41,92,255,1);
		background: rgba(41,92,255,0.06);
	}
	.addExamMain{
		position: fixed;
		width:100%;
		height:100%;
		background:rgba(0,0,0,0.5);
		left:0;
		top:0;
		z-index:100;
	}
	.addExamContent{
		width: 600px;
		height: auto;
		background: #FFFFFF;
		box-shadow: 0px 4px 16px 0px rgba(85,114,146,0.1);
		border-radius: 10px;
		position: fixed;
		left:50%;
		top:50%;
		transform: translate(-50%,-50%);
		z-index:2;
		box-sizing: border-box;
		padding:30px;
	}
	.addExamContent h3{
		font-size:18px;
		padding-bottom:20px;
	}
	.groupbutton{
		display: flex;
		align-items: center;
		padding-top:20px;
		justify-content: center;
	}
	.groupbutton >>> .el-button{
		width: 124px;
		height: 34px;
		background: #295CFF;
		border-radius: 10px;
		font-size: 14px;
		color: #FFFFFF;
		padding:0;
	}
	.groupbutton >>> .el-button:last-child{
		background: #F2F6FB;
		border-radius: 10px;
		border: 1px solid #295CFF;
		color:#295CFF;
		margin-left:24px;
	}
	.choosestudent{
		display: flex;
		align-items: center;
		padding:10px 0 24px;
	}
	.choosestudent span{
		font-size: 14px;
		color: #557292;
		width:100px;
	}
	.choosestudent  >>> .el-input__inner{
		width: 140px;
		height: 34px;
		border-radius: 10px;
		border: 1px solid #D8E4F0;
	}
	.choosestudent  >>>  .el-input__icon{
		line-height:34px;
	}
	.checkbox-group{
		font-size:14px;
		color:#5B6371;
		margin-bottom:20px;
	}
	.el-checkbox{
		margin-bottom:12px;
	}
	.addExamContent ul li{
		display: flex;
		align-items: center;
		padding-bottom:14px;
		font-size:14px;
	}
	.addExamContent ul li span{
		font-size:14px;
		width:80px;
		color: #557292;
		text-align: right;
	}
	.addExamContent ul li p{
		position: relative;
	}
	.addExamContent ul li p em{
		position: absolute;
		right:10px;
		top:50%;
		transform: translateY(-50%);
		color:#C0C4CC;
		cursor: pointer;
	}
	.addExamContent ul li >>>.el-input__inner{
		width: 400px;
		height: 34px;
		border-radius: 10px;
		border: 1px solid #D8E4F0;
	}
	.addExamContent ul li >>>.el-input__icon{
		line-height:34px;
	}
	.inputBox{
		width: 150px;
	}
	.inputBox1{
		width: 300px;
	}
	.addExamContent ul li div.inputBox1 >>> .el-input__inner{
		width:300px;
		height: 34px;
		border-radius: 10px;
		border: 1px solid #D8E4F0;
	}
	.addExamContent ul li >>> .el-range__icon{
		line-height:27px;
	}
	.groupbutton{
		display: flex;
		align-items: center;
		padding-top:20px;
	}
	.groupbutton >>> .el-button{
		width: 124px;
		height: 34px;
		background: #295CFF;
		border-radius: 10px;
		font-size: 14px;
		color: #FFFFFF;
		padding:0;
	}
	.groupbutton >>> .el-button:last-child{
		background: #F2F6FB;
		border-radius: 10px;
		border: 1px solid #295CFF;
		color:#295CFF;
		margin-left:24px;
	}
	.bcontentcolor{
		font-size:14px;
		color:#295CFF;
		display: inline-block;
		margin-left:20px;
		cursor: pointer;
	}
	.infosetcontentfont{
		color:#5B6371
	}
	.addExamContent ul li.infosetcontentfont span{
		width:auto;
		height: 26px;
		border-radius: 4px;
		border: 1px solid #D8E4F0;
		color:#B3B8C2;
		font-size:14px;
		text-align:left;
		line-height:26px;
		padding:0 16px 0 10px;
		margin-left:10px;
	}
	.addExamContent ul li.infosetcontentfont i{
		font-style:normal;
		color:#295CFF;
		padding:0 4px;
	}
	.addExamContent >>> .el-upload-dragger{
		width:522px;
	}
	.uploadbox{
		width:522px;
		height:220px;
		position:relative;
	}
	.uploadbox a{
		position:absolute;
		right:0;
		bottom:10px;
		font-size:14px;
		color:#295CFF;
	}
	.xzpjya{
		font-size:14px;
		color:#2A303B;
	}
	.xzpjya i{
		font-style: normal;
		color:#295CFF;
	}
	.tablestyle table{
		border-radius: 10px;
		border: 1px solid rgba(216,228,240,0.5);
	}
	.tablestyle table tr th{
		font-size:14px;
		font-weight:normal;
		background:#E8F0FA;
		height:42px;
	}
	.tablestyle table tr th:first-child{
		border-radius: 8px 0 0 0;
	}
	.tablestyle table tr th:last-child{
		border-radius: 0 8px 0 0;
	}
	.tablestyle table tr td{
		box-sizing: border-box;
		height:42px;
		text-align: left;
		font-size:14px;
		border-right:solid 1px rgba(216,228,240,0.34);
		padding:10px;
	}
	.tablestyle table tr td:last-child{
		border-right:none;
	}
	.tablestyle table tr td i{
		display: block;
		font-style: normal;
		font-size:12px;
		color:#999
	}
	.tablestyle table tr td em{
		display: block;
	}
	.tablestyle table tr td span{
		position:relative;
		display: inline-block;
		cursor: pointer;
	}
	.tablestyle table tr td span em{
		font-size:12px;
		font-style:normal;
	}
	.tablestyle table tr td span::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#000;
	}
	.tablestyle table tr td span.green{
		color:#288F41
	}
	.tablestyle table tr td span.green::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#288F41;
	}
	.tablestyle table tr td span.blue{
		color:#295CFF
	}
	.tablestyle table tr td span.blue::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#295CFF;
	}
	.tablestyle table tr td span.red{
		color:#EC555A
	}
	.tablestyle table tr td span.red::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#EC555A;
	}
	.tablestyle table tr td span.gray{
		color:#D8E4F0
	}
	.tablestyle table tr td span.gray::after{
		content:'';
		width: 43px;
		height: 1px;
		position:absolute;
		left:50%;
		bottom:-4px;
		transform: translateX(-50%);
		background:#D8E4F0;
	}
	.tablestyle table tr:nth-child(2n){
		background:#FAFAFB
	}
	.tablestyle table tr td >>> .el-checkbox{
		margin-right:9px;
	}
	.attentionPassword p{
		font-size:14px;
		color:#999;
		padding-bottom:20px;
	}
	.attentionPassword .el-checkbox{
		width:100%;
	}
	.attentionPassword >>> .el-input{
		margin-bottom:14px;
	}
	.attentionPassword >>> .el-input__inner{
		width:300px;
		height: 34px;
		border-radius: 10px;
		border: 1px solid #D8E4F0;
	}
	.breadBox >>> .el-breadcrumb__inner a,.breadBox >>> .el-breadcrumb__inner.is-link{
		font-weight:normal
	}
	.breadBox >>> .el-breadcrumb__item:last-child .el-breadcrumb__inner,
	.breadBox >>> .el-breadcrumb__item:last-child .el-breadcrumb__inner a,
	.breadBox >>> .el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
	.breadBox >>> .el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{
		font-weight:bold
	}
</style>